import React from 'react';
import { Row, Col, Form, Input, InputNumber, Select } from 'antd';
const R = require('ramda');
import BizParams from '../../../components/commons/BizParams'
import CurrencySelect from '../../../components/commons/CurrencySelect'
import PortSelect from '../../../components/commons/PortSelect'
import validator from '../../../utils/Validator'

const FormItem = Form.Item;
export default Form.create()(class DeclareInfo extends React.Component {
	constructor(props) {
		super(props);
		this.initData(props.dataSource, true);
	}

	componentWillReceiveProps(nextProps) {
		if (!R.equals(this.props.dataSource)(nextProps.dataSource)) {
			this.initData(nextProps.dataSource);
		}
	}

	initData = (dataSource, flag) => {
		dataSource = R.isNil(dataSource) ? {} : dataSource;
		let defaultShowSeaTrans = !R.isEmpty(dataSource) && dataSource.portoftransport === "1"; //海运
		let defaultShowSeaFCL = defaultShowSeaTrans && dataSource.enchasetype === "1"; //海运-整柜
		let defaultShowSeaLCL = defaultShowSeaTrans && dataSource.enchasetype === "2"; //海运-散货
		let showSeaTrans = !R.isEmpty(dataSource) && dataSource.portoftransport === "1"; //海运

		let defaultShowRoadTrans = !R.isEmpty(dataSource) && dataSource.declarationtype === "1" && dataSource.portoftransport === "2"; //陆运
		let defaultShowRoadTOC = defaultShowRoadTrans && dataSource.carmodel === "1"; //陆运-吨车
		let defaultShowRoadCC = defaultShowRoadTrans && dataSource.carmodel === "2";//陆运-柜车
		let showRoadTrans = !R.isEmpty(dataSource) && dataSource.declarationtype === "1" && dataSource.portoftransport === "2"; //陆运

		let showAirTrans = !R.isEmpty(dataSource) && dataSource.declarationtype === "1" && dataSource.portoftransport === "3"; //空运
		let defaultShowAirTrans = !R.isEmpty(dataSource) && dataSource.declarationtype === "1" && dataSource.portoftransport === "3"; //空运
		let showMemo = !R.isEmpty(dataSource) && dataSource.declarationtype === "1"; //是否显示综服报关海陆空的备注，相当于是否选择的是否是综服报关
		let defaultShowMemo = !R.isEmpty(dataSource) && dataSource.declarationtype === "1";//是否显示综服报关海陆空的备注，相当于是否选择的是否是综服报关

		let defaultShowEmailType = !R.isEmpty(dataSource) && dataSource.declarationtype === "2" && dataSource.cstdeclarationtype === "1"; //快递邮寄资料
		let defaultShowNoPaperType = !R.isEmpty(dataSource) && dataSource.declarationtype === "2" && dataSource.cstdeclarationtype === "2"; //无纸化报关

		let defaultShowContractNo = !R.isEmpty(dataSource) && (dataSource.contracttype === "2" || dataSource.contracttype === "3"); //合同协议号生成方式!== 1 则显示

		if(flag){
			this.state = {
				//综服报关
				showSeaTrans: defaultShowSeaTrans, //海运
				showSeaFCL: defaultShowSeaFCL, //海运-整柜
				showSeaLCL: defaultShowSeaLCL, //海运-散货
				showRoadTrans: defaultShowRoadTrans, //陆运
				showRoadTOC: defaultShowRoadTOC, //陆运-吨车
				showRoadCC: defaultShowRoadCC,//陆运-柜车
				showAirTrans: defaultShowAirTrans, //空运
				//客户自行报关
				showEmailType: defaultShowEmailType, //快递邮寄资料
				showNoPaperType: defaultShowNoPaperType, //无纸化报关

				//是否合同协议号输入框
				showContractNo: defaultShowContractNo, //合同协议号生成方式!== 1 则显示

				//是否综服报关
				showMemo: defaultShowMemo,

				//default value use to recover page
				//综服报关
				defaultShowSeaTrans: defaultShowSeaTrans, //海运
				defaultShowSeaFCL: defaultShowSeaFCL, //海运-整柜
				defaultShowSeaLCL: defaultShowSeaLCL, //海运-散货
				defaultShowRoadTrans: defaultShowRoadTrans, //陆运
				defaultShowRoadTOC: defaultShowRoadTOC, //陆运-吨车
				defaultShowRoadCC: defaultShowRoadCC,//陆运-柜车
				defaultShowAirTrans: defaultShowAirTrans, //空运
				//客户自行报关
				defaultShowEmailType: defaultShowEmailType, //快递邮寄资料
				defaultShowNoPaperType: defaultShowNoPaperType, //无纸化报关

				//是否合同协议号输入框
				defaultShowContractNo: defaultShowContractNo, //合同协议号生成方式!== 1 则显示

				//是否综服报关
				defaultShowMemo: defaultShowMemo
			};
		}else{
			this.setState({
				//综服报关
				showSeaTrans: defaultShowSeaTrans, //海运
				showSeaFCL: defaultShowSeaFCL, //海运-整柜
				showSeaLCL: defaultShowSeaLCL, //海运-散货
				showRoadTrans: defaultShowRoadTrans, //陆运
				showRoadTOC: defaultShowRoadTOC, //陆运-吨车
				showRoadCC: defaultShowRoadCC,//陆运-柜车
				showAirTrans: defaultShowAirTrans, //空运
				//客户自行报关
				showEmailType: defaultShowEmailType, //快递邮寄资料
				showNoPaperType: defaultShowNoPaperType, //无纸化报关

				//是否合同协议号输入框
				showContractNo: defaultShowContractNo, //合同协议号生成方式!== 1 则显示

				//是否综服报关
				showMemo: defaultShowMemo,

				//default value use to recover page
				//综服报关
				defaultShowSeaTrans: defaultShowSeaTrans, //海运
				defaultShowSeaFCL: defaultShowSeaFCL, //海运-整柜
				defaultShowSeaLCL: defaultShowSeaLCL, //海运-散货
				defaultShowRoadTrans: defaultShowRoadTrans, //陆运
				defaultShowRoadTOC: defaultShowRoadTOC, //陆运-吨车
				defaultShowRoadCC: defaultShowRoadCC,//陆运-柜车
				defaultShowAirTrans: defaultShowAirTrans, //空运
				//客户自行报关
				defaultShowEmailType: defaultShowEmailType, //快递邮寄资料
				defaultShowNoPaperType: defaultShowNoPaperType, //无纸化报关

				//是否合同协议号输入框
				defaultShowContractNo: defaultShowContractNo, //合同协议号生成方式!== 1 则显示

				//是否综服报关
				defaultShowMemo: defaultShowMemo
			})
		}

	}

	form = {};

	handleCollectForm = () => {
		return this.form;
	}

	handleResetFields = () => {
		this.setState({
			showSeaTrans: this.state.defaultShowSeaTrans, showSeaFCL: this.state.defaultShowPremium,
			showSeaLCL: this.state.defaultShowSeaLCL, showRoadTrans: this.state.defaultShowRoadTrans,
			showRoadTOC: this.state.defaultShowRoadTOC, showRoadCC: this.state.defaultShowRoadCC,
			showAirTrans: this.state.defaultShowAirTrans, showEmailType: this.state.defaultShowEmailType,
			showNoPaperType: this.state.defaultShowNoPaperType, showContractNo: this.state.defaultShowContractNo,
			showMemo: this.state.defaultShowMemo
		});
		this.props.form.resetFields();
	}

	handleChangeContractType = (value) => {
		if (value === "1") {
			//系统生成的话，要清空手输的协议号
			this.props.form.setFieldsValue({ contractno: "" });
		};
		this.setState({ showContractNo: value !== "1" });
	}

	handleChangeDeclarationType = (value) => {
		if (value === "1") {
			//综服企业报关，清理客户报关
			this.props.form.setFieldsValue({ cstdeclarationtype: "", cstdeclarationcode: "", cstreceiver: "", cstrectelephone: "", cstdeclarationaddress: "" });//清理数据
			this.setState({ showEmailType: false, showNoPaperType: false, showMemo: true });//隐藏元素
			//显示综服报关元素
			if (this.props.form.getFieldValue("portoftransport") === "1") {//海运
				this.setState({ showSeaTrans: true });
			} else if (this.props.form.getFieldValue("portoftransport") === "2") {//陆运
				this.setState({ showRoadTrans: true });
			} else if (this.props.form.getFieldValue("portoftransport") === "3") {//空运
				this.setState({ showAirTrans: true });
			}
		} else if (value === "2") {
			this.props.form.setFieldsValue({ totalvolume: "", carmodel: "", weightSea: "", weightRoad: "", plateno: "", mainfestno: "", tonnage: "", containertype: "", containerno: "", enchasetype: "", size20: "", size40: "", size45: "", sizeother: "",boxno: "", memo: "" });//清理数据
			this.setState({ showSeaFCL: false, showSeaLCL: false, showRoadTrans: false, showRoadTOC: false, showRoadCC: false, showAirTrans: false, showMemo: false });//隐藏元素
		}
	}

	handleChangePortOfTransport = (value) => {
		//如果是综服企业报关 才执行清理跟显隐的逻辑
		if (this.props.form.getFieldValue("declarationtype") === "1") {
			if (value === "1") {//海运
				this.props.form.setFieldsValue({ totalvolume: "", carmodel: "", plateno: "", mainfestno: "", tonnage: "", containertype: "", containerno: "" });//清理数据
				this.setState({ showRoadTrans: false, showRoadTOC: false, showRoadCC: false, showAirTrans: false, showSeaTrans: true });//隐藏元素
			 } else if (value === "2") {//陆运
				this.props.form.setFieldsValue({ totalvolume: "", enchasetype: "", size20: "", size40: "", size45: "",  sizeother: "",boxno: "" });//清理数据
				this.setState({ showSeaTrans: false, showSeaFCL: false, showSeaLCL: false, showAirTrans: false, showRoadTrans: true });//隐藏元素
			} else if (value === "3") {//空运
				this.props.form.setFieldsValue({ carmodel: "", weightSea: "", weightRoad: "", plateno: "", mainfestno: "", tonnage: "", containertype: "", containerno: "", enchasetype: "", size20: "", size40: "", size45: "",sizeother: "", boxno: "" });//清理数据
				this.setState({ showSeaTrans: false, showSeaFCL: false, showSeaLCL: false, showRoadTrans: false, showRoadTOC: false, showRoadCC: false, showAirTrans: true });//隐藏元素
			}
		}
		if (this.props.form.getFieldValue("declarationtype") === "2") {
            if (value === "1") {//海运
                this.props.form.setFieldsValue({ totalvolume: "", carmodel: "", plateno: "", mainfestno: "", tonnage: "", containertype: "", containerno: "" });//清理数据
                this.setState({ showRoadTrans: false, showRoadTOC: false, showRoadCC: false, showAirTrans: false, showSeaTrans: true });//隐藏元素
		}else if(value === "2"||value === "3"){
                this.props.form.setFieldsValue({ totalvolume: "", carmodel: "", weightSea: "", weightRoad: "", plateno: "", mainfestno: "", tonnage: "", containertype: "", containerno: "", enchasetype: "", size20: "", size40: "", size45: "", sizeother: "",boxno: "", memo: "" });//清理数据
            this.setState({ showSeaTrans: false, showSeaFCL: false, showSeaLCL: false, showRoadTrans: false, showRoadTOC: false, showRoadCC: false, showAirTrans: false, showMemo: false });//隐藏元素
			}
	}}

	handleChangeEnchaseType = (value) => {
		if (value === "2") {//散柜
			//清理整柜
			this.props.form.setFieldsValue({ size20: "", size40: "", size45: "",sizeother: "", boxno: "" });//清理数据
			this.setState({ showSeaFCL: false, showSeaLCL: true });//隐藏元素
		} else {
			this.setState({ showSeaFCL: true, showSeaLCL: false });//隐藏元素
		}
	}

	handleChangeCarModel = (value) => {
		if (value === "1") {//柜车
			//清理吨车
			this.props.form.setFieldsValue({ tonnage: "" });//清理数据
			this.setState({ showRoadTOC: false, showRoadCC: true });//隐藏元素
		} else if (value === "2") {//吨车
			this.props.form.setFieldsValue({ containerno: "", containertype: "" });//清理数据
			this.setState({ showRoadCC: false, showRoadTOC: true });//隐藏元素
		}
	}

	handleChangeCstDeclarationType = (value) => {
		if (value === "1") {//快递寄资料
			//清理无纸化报关
			this.props.form.setFieldsValue({ cstdeclarationcode: "" });//清理数据
			this.setState({ showNoPaperType: false, showEmailType: true });//隐藏元素
		} else if (value === "2") {//无纸化
			//清理快递寄资料
			this.props.form.setFieldsValue({ cstreceiver: "", cstrectelephone: "", cstdeclarationaddress: "" });//清理数据
			this.setState({ showEmailType: false, showNoPaperType: true });//隐藏元素
		}
	}

	handleChangeCurrency = (value) => {
		if (this.props.handleChangeCurrencyType) {
			this.props.handleChangeCurrencyType(value);
		}
	}

	handleGetCurrencyType = () => {
		return this.props.form.getFieldValue("currencytype");
	}

	checkDeclareInfo = () => {
		let flag = true;
		this.props.form.validateFields({force: true}, (errors, values) => {
			if (errors) {
				flag = false
			} else {
				let temp = R.omit(['weightRoad', 'weightSea'])(values);
				let weight = undefined;
				if (this.state.showSeaTrans) {
					weight = values.weightSea;
				}
				if (this.state.showRoadTrans) {
					weight = values.weightRoad;
				}
				temp.weight = weight;
				this.form = temp;
			}
		})
		return flag;
	};

	render() {
		let dataSource = R.isNil(this.props.dataSource) ? {} : this.props.dataSource;
		const { getFieldDecorator } = this.props.form;
		let formItemLayout = {
			labelCol: { xs: { span: 8 }, sm: { span: 8 } },
			wrapperCol: { xs: { span: 15 }, sm: { span: 14 } }
		};
		const formItemLayout2 = {
            labelCol: {span: 4},
            wrapperCol: {span: 18}
		};
		let disabledContracttype = [];
		let customer = R.isNil(this.props.customer) ? {} : this.props.customer;
        if (customer.csttype === "2") disabledContracttype = ['2', '3'];
		return (
			<Form>
				<Row>
					<Col span={12}>
						<FormItem {...formItemLayout} label="报关币种" hasFeedback>
							{getFieldDecorator('currencytype', {
								rules: [{
									required: true, message: '请选择报关币种'
								}],
								initialValue: dataSource.currencytype
							})(
								<CurrencySelect disabled={this.props.disabled} onChange={this.handleChangeCurrency.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12}>
						<FormItem {...formItemLayout} label="进境关别" hasFeedback>
							{getFieldDecorator('portofentryid', {
								rules: [{
									required: true, message: '请选择进境关别'
								}],
								initialValue: dataSource.portofentryid
							})(
								<PortSelect disabled={this.props.disabled} />
								)}
						</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span={12}>
						<FormItem {...formItemLayout} label="协议号生成方式" hasFeedback>
							{getFieldDecorator('contracttype', {
								rules: [{
									required: true, message: '请选择合同协议号生成方式'
								}],
								initialValue: dataSource.contracttype
							})(
								<BizParams disabled={this.props.disabled} disabledKeys={disabledContracttype} sprCode='contractType' onChange={this.handleChangeContractType.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showContractNo ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="报关协议号" hasFeedback>
							{getFieldDecorator('contractno', {
								rules: [{
									required: this.state.showContractNo, message: '请输入报关协议号'
								}],
								initialValue: dataSource.contractno
							})(
								<Input maxLength="30" disabled={this.props.disabled} />
								)}
						</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span={12}>
						<FormItem {...formItemLayout} label="报关方式" hasFeedback>
							{getFieldDecorator('declarationtype', {
								rules: [{
									required: true, message: '请选择报关方式'
								}],
								initialValue: dataSource.declarationtype
							})(
								<BizParams disabled={this.props.disabled} sprCode='declarationtype' onChange={this.handleChangeDeclarationType.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12}>
						<FormItem {...formItemLayout} label="运输方式" hasFeedback>
							{getFieldDecorator('portoftransport', {
								rules: [{
									required: true, message: '请选择运输方式'
								}],
								initialValue: dataSource.portoftransport
							})(
								<BizParams disabled={this.props.disabled} sprCode='portoftransport' onChange={this.handleChangePortOfTransport.bind(this)} />
								)}
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-海运 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showSeaTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="装箱方式" hasFeedback>
							{getFieldDecorator('enchasetype', {
								rules: [{
									required: this.state.showSeaTrans, message: '请选择装箱方式'
								}],
								initialValue: dataSource.enchasetype
							})(
								<BizParams disabled={this.props.disabled} sprCode='enchasetype' onChange={this.handleChangeEnchaseType.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showSeaTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="过磅重量" hasFeedback>
							{getFieldDecorator('weightSea', {
								rules: [{
									pattern: validator.DECIMAL2.pattern, message: validator.DECIMAL2.message,
								}],
								initialValue: dataSource.weight
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={9999999999999999} maxLength="18" />
								)}
							kg
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-海运 end   -------------------------------*/}
				{/*综服报关-海运-整柜 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showSeaFCL ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="20尺柜" hasFeedback>
							{getFieldDecorator('size20', {
								initialValue: R.isNil(dataSource.size20) ? undefined : dataSource.size20
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={99999999999} precision={0} maxLength="11"/>
								)}
							个
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showSeaFCL ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="40尺柜" hasFeedback>
							{getFieldDecorator('size40', {
								initialValue: R.isNil(dataSource.size40) ? undefined : dataSource.size40
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={99999999999} precision={0} maxLength="11"/>
								)}
							个
						</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span={12} style={{ display: this.state.showSeaFCL ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="45尺柜" hasFeedback>
							{getFieldDecorator('size45', {
								initialValue: R.isNil(dataSource.size45) ? undefined : dataSource.size45
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={99999999999} precision={0} maxLength="11"/>
								)}
							个
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showSeaFCL ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="其他柜型" hasFeedback>
							{getFieldDecorator('sizeother', {
								initialValue: R.isNil(dataSource.sizeother) ? undefined : dataSource.sizeother
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={99999999999} precision={0} maxLength="11"/>
								)}
							个
						</FormItem>
					</Col>
				</Row>

				<Row>
					<Col span={23} style={{ display: this.state.showSeaFCL ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout2} label="集装箱号" hasFeedback>
							{getFieldDecorator('boxno', {
								initialValue: dataSource.boxno
							})(
								<Input disabled={this.props.disabled} maxLength="1000" placeholder="多个柜号则用逗号隔开" />
								)}
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-海运-整柜 end   -------------------------------*/}
				{/*综服报关-陆运 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showRoadTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="车型" hasFeedback>
							{getFieldDecorator('carmodel', {
								rules: [{
									required: this.state.showRoadTrans, message: '请选择车型'
								}],
								initialValue: dataSource.carmodel
							})(
								<BizParams disabled={this.props.disabled} sprCode='carmodel' onChange={this.handleChangeCarModel.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showRoadTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="过磅重量" hasFeedback>
							{getFieldDecorator('weightRoad', {
								rules: [{
									pattern: validator.DECIMAL2.pattern, message: validator.DECIMAL2.message,
								}],
								initialValue: dataSource.weight
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={9999999999999999} maxLength="18"/>
								)}
							kg
						</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span={12} style={{ display: this.state.showRoadTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="车牌号码" hasFeedback>
							{getFieldDecorator('plateno', {
								initialValue: dataSource.plateno
							})(
								<Input disabled={this.props.disabled} maxLength="50" />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showRoadTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="载货清单号/六联清单号" hasFeedback>
							{getFieldDecorator('mainfestno', {
								initialValue: dataSource.mainfestno
							})(
								<Input disabled={this.props.disabled} maxLength="50" />
								)}
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-陆运 end   -------------------------------*/}
				{/*综服报关-陆运-吨车 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showRoadTOC ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="吨位" hasFeedback>
							{getFieldDecorator('tonnage', {
								rules: [{
									pattern: validator.DECIMAL2.pattern, message: validator.DECIMAL2.message,
								}],
								initialValue: dataSource.tonnage
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={9999999999999999} maxLength="18"/>
								)}
							吨
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-陆运-吨车 end   -------------------------------*/}
				{/*综服报关-陆运-柜车 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showRoadCC ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="柜型" hasFeedback>
							{getFieldDecorator('containertype', {
								initialValue: dataSource.containertype
							})(
								<BizParams disabled={this.props.disabled} sprCode='containerType' />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showRoadCC ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="集装箱与封条号" hasFeedback>
							{getFieldDecorator('containerno', {
								initialValue: dataSource.containerno
							})(
								<Input disabled={this.props.disabled} maxLength="100" placeholder="格式:箱号1,封条1;箱号2,封条2" />
								)}
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-陆运-柜车 end   -------------------------------*/}
				{/*综服报关-空运 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showAirTrans ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="总体积" hasFeedback>
							{getFieldDecorator('totalvolume', {
								rules: [
									{required: this.state.showAirTrans, message: '请输入总体积'},
									{pattern: validator.DECIMAL2.pattern, message: validator.DECIMAL2.message}
								],
								initialValue: dataSource.totalvolume
							})(
								<InputNumber disabled={this.props.disabled} min={0} max={9999999999999999} maxLength="18"/>
								)}
							CBM
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-空运 end   -------------------------------*/}
				{/*综服报关-备注 begin-------------------------------*/}
				<Row>
					<Col span={12} style={{ display: this.state.showMemo ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="备注" hasFeedback>
							{getFieldDecorator('memo', {
								initialValue: dataSource.memo
							})(
								<Input.TextArea disabled={this.props.disabled} maxLength="100" autosize={true}/>
								)}
						</FormItem>
					</Col>
				</Row>
				{/*综服报关-备注 end   -------------------------------*/}
				{/*客户报关 begin -------------------------------*/}
				<Row>
					<Col span={12} style={{ display: !this.state.showMemo ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="客户报关方式" hasFeedback>
							{getFieldDecorator('cstdeclarationtype', {
								rules: [{
									required: !this.state.showMemo, message: '请选择客户报关方式'
								}],
								initialValue: dataSource.cstdeclarationtype
							})(
								<BizParams disabled={this.props.disabled} sprCode='cstdeclarationtype' onChange={this.handleChangeCstDeclarationType.bind(this)} />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showEmailType ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="收件地址" hasFeedback>
							{getFieldDecorator('cstdeclarationaddress', {
								rules: [{
									required: this.state.showEmailType, message: '请输入报关资料收件地址'
								}],
								initialValue: dataSource.cstdeclarationaddress
							})(
								<Input disabled={this.props.disabled} maxLength="100" />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showNoPaperType ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="报关行代码" hasFeedback>
							{getFieldDecorator('cstdeclarationcode', {
								rules: [{
									required: this.state.showNoPaperType, message: '请输入10位报关行代码'
								}],
								initialValue: dataSource.cstdeclarationcode
							})(
								<Input disabled={this.props.disabled} maxLength="20" />
								)}
						</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span={12} style={{ display: this.state.showEmailType ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="收件人姓名" hasFeedback>
							{getFieldDecorator('cstreceiver', {
								rules: [{
									required: this.state.showEmailType, message: '请输入收件人姓名'
								}],
								initialValue: dataSource.cstreceiver
							})(
								<Input disabled={this.props.disabled} maxLength="20" />
								)}
						</FormItem>
					</Col>
					<Col span={12} style={{ display: this.state.showEmailType ? "inline-block" : "none" }}>
						<FormItem {...formItemLayout} label="收件人电话" hasFeedback>
							{getFieldDecorator('cstrectelephone', {
								rules: [{
									required: this.state.showEmailType, message: '请输入收件人电话'
								}],
								initialValue: dataSource.cstrectelephone
							})(
								<Input disabled={this.props.disabled} maxLength="20" />
								)}
						</FormItem>
					</Col>
				</Row>
				{/*客户自行报关 end   -------------------------------*/}
			</Form>
		)
	}
})
